<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="text/javascript">
        //209000837 刘婷
        let res = new Promise((resolve, reject) => {
        })
        console.log(res);

        let res1 = new Promise((resolve, reject) => {
            resolve('resolve')
        })
        console.log(res1);

        let res2 = new Promise((resolve, reject) => {
            resolve('rejected')
        })
        console.log(res2);
    </script>
    <script>
        function getNumber() {
            var P = new Promise(function (resolve, reject) {
                setTimeout(function () {
                    var num = Math.ceil(Math.random() * 100);
                    if (num <= 60) {
                        resolve(num);
                    }
                    else {
                        reject('数字大于60');
                    }
                }), 2000
            }
            );
            return P;
        }

        getNumber()
            .then(
                function (data) {
                    console.log('resloved');
                    console.log(data);
                },
                function (reason, data) {
                    console.log('rejected');
                    console.log(reason);
                }
            );
    </script>

</body>

</html>